const path = require('path')
const rules = require('./webpack.rules');
const {VueLoaderPlugin} = require('vue-loader')


function resolve(dir) {
  return path.join(__dirname, dir)
}

rules.push({
  test: /\.css$/,
  use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
});
rules.push({
  test: /\.vue$/,
  use: {
    loader: 'vue-loader'
  }
},);
rules.push({
  test: /\.(png|jpg|gif|svg)$/,
  use: [
    {
      loader: 'file-loader',
      options: {
        esModule: false
      }
    }
  ],
});

module.exports = {
  // Put your normal webpack config below here
  module: {
    rules,
  },
  plugins: [
    // 请确保引入这个插件！
    new VueLoaderPlugin()
  ],
  resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      '@': resolve('src/renderer')
    },
  },
};
